package com.itheima.tliasmanagement.mapper;

import com.github.pagehelper.Page;
import com.itheima.tliasmanagement.dto.ClassListDto;
import com.itheima.tliasmanagement.entity.Clazz;
import com.itheima.tliasmanagement.vo.ClazzListVo;
import com.itheima.tliasmanagement.vo.NameValueVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {

    Page<ClazzListVo> pageQuery(ClassListDto dto);

    Page<ClazzListVo> page(ClassListDto dto);

    @Select("select * from clazz where name = #{name}")
    Clazz selectByName(String name);

    void insert(Clazz clazz);

    @Select("select * from clazz where id = #{id}")
    Clazz selectById(Integer id);

    void update(Clazz clazz);

    @Delete("delete from clazz where id = #{id}")
    void deleteById(Integer id);

    @Select("select * from  clazz")
    List<Clazz> all();

    List<NameValueVo> studentCountData();

}
